﻿#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
	int n = 9;
	float* pFloat = (float*)&n;
	printf("n的值为：%d\n",n);
	printf("*pFloat的值为：%f\n",*pFloat);
	
	* pFloat = 9.0;
	printf("num的值为：%d\n",n);
	printf("*pFloat的值为：%f\n",*pFloat);

	return 0;
}

//X86,环境小端字节序

int main7()
{
	int a[4] = { 1, 2, 3, 4 };
	int* ptr1 = (int*)(&a + 1);
	int* ptr2 = (int*)((int)a + 1);
	printf("%x,%x\n", ptr1[-1], *ptr2);
	return 0;
}

int main6()
{
	unsigned int i;
	for (i = 9; i >= 0; i--)
	{
		printf("%u\n", i);
	}
	return 0;
}

//unsigned char i = 0;
int main5()
{
	for (int i = 0; i <= 255; i++)
	{
		printf("hello world\n");
	}
	return 0;
}

int main4()
{
	char a[1000];
	for (int i = 0; i < 1000; i++)
	{
		a[i] = -1 - i;
	}
	printf("%d\n", strlen(a));
	return 0;
}

int main3()
{
	char a = -128;
	printf("%u\n", a);
	return 0;
}

int main2()
{
	char a = -1;
	signed char b = -1;
	unsigned char c = -1;
	printf("a=%d,b=%d,c=%d\n", a, b, c);
	return 0;
}

int main1()
{
	int a = 1;
	char* p = (char*) & a;
	if (*p == 1)
		printf("小端存储\n");
	else
		printf("大端存储\n");

	return 0;
}
